package com.yaowk.common.constant;

import com.jfinal.config.*;
import com.jfinal.core.JFinal;
import com.jfinal.template.Engine;
import com.yaowk.common.ext.JsonRenderFactory;
import com.yaowk.common.interceptor.CorsInterceptor;
import com.yaowk.common.interceptor.DevErrorInterceptor;

/**
 * Created by yaowk on 17-8-15.
 */
public abstract class BaseConfig extends JFinalConfig {

    protected Routes routes;

    public static void start() {
        start(8080);
    }

    public static void start(int port) {
        start(port, "/");
    }

    public static void start(int port, String content) {
        start(port, content, "web");
    }

    public static void start(int port, String content, String module) {
        JFinal.start(module + "/src/main/webapp", port, content);
    }

    @Override
    public void configConstant(Constants constants) {
        constants.setRenderFactory(new JsonRenderFactory());
    }

    @Override
    public void configEngine(Engine engine) {

    }

    @Override
    public void configHandler(Handlers handlers) {

    }
}
